GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e4e8a8...7e2740 )
by Benjamin
01:35
created

shouldComponentUpdate.js ➔ shouldHeaderUpdate   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 32
rs 8.8571
nop 2
1
import deepEqual from 'deep-equal';
2
import { getLastUpdate } from './lastUpdate';
3
4
export function shouldGridUpdate(nextProps) {
5
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
6
7
    const { reducerKeys, stateKey, store } = this.props;
8
9
    const nextUpdate = getLastUpdate(store, stateKey, reducerKeys);
10
11
    result = (
12
        !deepEqual(nextUpdate, this._lastUpdate)
13
        || !equalProps(nextProps, this._lastProps)
14
    );
15
16
    this._lastUpdate = nextUpdate;
17
    this._lastProps = nextProps;
18
19
    return result;
20
}
21
22
export function shouldPagerUpdate(nextProps, nextState) {
23
24
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
25
26
    const limitedNextProps = {
27
        gridData: nextProps.gridData,
28
        state: this.state
29
    };
30
31
    const limitedProps = {
32
        gridData: this.props.gridData,
33
        state: nextState
34
    };
35
36
    result = (
37
        !deepEqual(limitedNextProps, limitedProps)
38
    );
39
40
    return result;
41
}
42
43
export function shouldHeaderUpdate(nextProps, nextState) {
0 ignored issues
show
Unused Code introduced by
The parameter nextState is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter nextProps is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
44
    // let result = true;
45
    // to do, stop this
46
    return true;
47
48
    /* eslint-disable no-unreachable */
49
50
    // const menuState = state =>
51
    //     state && state.get('header-row');
52
53
    // const limitedNextProps = {
54
    //     columns: nextProps.columns,
55
    //     menuState: menuState(nextProps.menuState),
56
    //     state: nextState
57
    // };
58
59
    // const limitedProps = {
60
    //     columns: this.previousColumns,
61
    //     menuState: menuState(this.props.menuState),
62
    //     state: this.state
63
    // };
64
65
    // result = (
66
    //     !deepEqual(limitedNextProps, limitedProps)
67
    // );
68
69
    // this.previousColumns = this.props.columns.slice();
70
71
    // return result;
72
73
    /* eslint-enable no-unreachable */
74
}
75
76
export function shouldRowUpdate(nextProps) {
77
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
78
79
    // unique key created by setData action/reducer
80
    const key = nextProps.row.get('_key');
81
82
    const isSelected = rows => Boolean(rows && rows.get(key));
83
84
    const isMenuShown = rows => Boolean(rows && rows.get(key));
85
86
    const isEdited = editorState => Boolean(
87
        editorState
88
        && editorState.get(key)
89
        && editorState.get(key).values
90
    );
91
92
    const limitedNextProps = {
93
        columns: slimColumn(nextProps.columns),
94
        isEdited: isEdited(nextProps.editorState),
95
        currentValues: isEdited(nextProps.editorState)
96
            ? nextProps.editorState.get(key)
97
            : null,
98
        isMenuShown: isMenuShown(nextProps.menuState),
99
        row: nextProps.row,
100
        index: nextProps.index,
101
        isSelected: isSelected(nextProps.selectedRows),
102
        isDragging: nextProps.isDragging
103
    };
104
105
    const limitedProps = {
106
        columns: this.previousColumns,
107
        isEdited: isEdited(this.props.editorState),
108
        currentValues: isEdited(this.props.editorState)
109
            ? this.props.editorState.get(key)
110
            : null,
111
        isMenuShown: isMenuShown(this.props.menuState),
112
        row: this.props.row,
113
        index: this.props.index,
114
        isSelected: isSelected(this.props.selectedRows),
115
        isDragging: this.props.isDragging
116
    };
117
118
    this.previousColumns = slimColumn(this.props.columns.slice());
119
120
    result = (
121
        !deepEqual(limitedNextProps, limitedProps)
122
    );
123
124
    return result;
125
}
126
127
export const slimColumn = cols =>
128
    cols.map(col => ({ hidden: col.hidden, dataIndex: col.dataIndex }));
129
130
export const equalProps = (props = {}, newProps = {}) => {
131
    return props.height === newProps.height
132
        && deepEqual(props.classNames, newProps.classNames)
133
        && deepEqual(props.events, newProps.events);
134
};
135